<template>
    <div>
        <el-menu :default-active="defaultActive" class="el-menu-vertical-demo" @select="handleOpen" @close="handleClose"
            background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" :router="true">
            <el-menu-item v-for="(item, index) in menuList" :index="item.id">
                <!-- <i class="el-icon-menu"></i> -->
                <span slot="title">{{ item.name }}</span>
            </el-menu-item>
        </el-menu>
    </div>
</template>

<script>
import { routeList } from '../common/route'
export default {
    components: {},
    props: {},
    data() {
        return {
            menuList: routeList,
            defaultActive: ''
        };
    },
    mounted() {
        this.defaultActive = localStorage.getItem('selectId') || this.menuList[0]?.id 
    },
    watch: {

    },
    computed: {

    },
    methods: {
        handleOpen(key, keyPath) {
            localStorage.setItem('selectId', key)
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        }
    },
};
</script>
<style scoped>
.el-menu-item span {
    font-size: medium;
}

.el-menu {
    width: 2.5rem;
    height: 100vh;
}
</style>